<style type="text/css">
</style>
<div class="register-container container" style="background:#00c568 url( {{tomedia(main.lbg) || '../core/resource/images/bg-login.png'}}) no-repeat;">
    <div class="clearfix">
        <div class="register" style="margin:auto;margin-top:10%;">
            <form action="" method="post" role="form" id="form1">
                <a href="/index.php" class="login-logo">
					<img src="{{pagedata.llogo || '../core/resource/images/ng-logo.png'}}">
                </a>
				<div class="form-group" ng-show="pagedata.mobile_code">
					
					<div>
						<div class="radio radio-inline">
							<label>
								<input type="radio" value="1" ng-model="pagedata.item.login_type"/>账号登陆
							</label>
						</div>
						<div class="radio radio-inline">
							<label>
								<input type="radio" value="2" ng-model="pagedata.item.login_type"/>手机登陆
							</label>
						</div>
					</div>
				</div>
				<div>
                <div class="form-group">
                    <label for="username">账号：</label>
                    <input type="text" ng-model="pagedata.info.username" placeholder="输入您的账号" class="form-control ">
                </div>
                <div class="form-group">
                    <label for="password">密码：</label>
                    <input type="password" ng-model="pagedata.info.pwd" placeholder="输入您的密码" class="form-control ">
                </div>
				</div>
				<div ng-show="pagedata.info.login_type==2">
					<div class="form-group">
						<label for="username">手机号：</label>
						<input type="text" ng-model="pagedata.info.mobile" placeholder="输入您的账号" class="form-control ">
					</div>
					

					<div class="form-group input-group">
							<div class="input-group-addon"><i class="fa fa-info"></i></div>
							<input ng-model="pagedata.info.smscode" class="form-control" style="width:110px;" placeholder="请输入验证码">
							<a class="jy-btn jy-btn-default" href="javascript:;" id="smscode" ng-click="pagedata.send_smscode(pagedata.item.mobile,pagedata.item.code)" style="text-decoration: none;margin:2px 4px">发送验证码</a>
					</div>
				</div>
				<div class="form-group input-group" ng-show="pagedata.verify_code">
						<div class="input-group-addon"><i class="fa fa-info"></i></div>
						<input ng-model="pagedata.info.code" class="form-control" style="width:110px;" placeholder="请输入验证码">
						<a href="javascript:;" id="code" ng-click="code_image('imgverify')" style="text-decoration: none"><img id="imgverify" src="" style="height:34px;" title="点击图片更换验证码"/></a>
				</div>
				<div class="form-group" ng-init="code_image('imgverify')">
					<div id="submit" style="text-align:center;padding-top:7px;" ng-click="post(pagedata.info,'post');" class="login-btn">登录平台</div>
					<div id="submit" style="text-align:center;padding-top:7px;" ng-click="pagedata.wechat_login()" class="login-btn">微信一键登录</div>
				</div>
				<div class="form-group other-login-line">
					<div class="other-login-line"><div class="label"> 使用第三方账号登录 </div><div class="line"></div></div>
					<div class="other-login clearfix">
						<div ng-show="pagedata.wechat_login" class="login-btn wechat" ng-click="post({},'wechat_login')"><i class="fa fa-wechat"></i></div>
					</div>
					<div class="login-footer">忘记密码？<a class="action" href="javascript:;" ng-click="pagedata.foget()">找回密码</a></div>
				</div>
            </form>
			<div class="text">
				<p class="title">温馨提示</p>
				<p>请使用管理员分配的账号密码进行登录，管理自己的店铺哦~有问题请联系系统管理员。</p>
			</div>
        </div>
    </div>
</div>
<div id="modal_login_ewm"  class="modal fade" tabindex="-1" style="z-index:99999;display:none">
    <div class="modal-dialog" style="width:320px;">
        <div class="modal-content">
			<div class="modal-header"><button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button><h3></h3></div>
				<div class="modal-body" style="padding:10px;">
					<div id="login_ewm" style="width:150px;margin:0 auto"></div>
					<div style="text-align:center">扫描二维码一键登录</div>
				</div>
		</div>
	</div>
</div>
<script>
scope.pagedata.send_smscode=function(mobile,code){
	if(!mobile){
		alert('请先填写手机号！');
		return false;
	}
	if(scope.pagedata.verify_code && !code){
		alert('请先填写下面的图片验证码！');
		return false;
	}
	if(scope.pagedata.sending){
		return false;
	}
	var params={'data':{'mobile':mobile,'code':code},'op':'send_code'};
	params.callback=function(res){
		if(res=='success'){
			//发送成功，开始倒计时 
			scope.pagedata.sending=true;
			scope.count_down(60,'smscode','秒后重新发送',function(){
				scope.pagedata.sending=false;
				$('#smscode').text('重新发送');
			});
		}else{
			scope.message('验证码发送失败！');
		}
	}
	scope.post_json(params);
}
scope.pagedata.foget=function(){
	scope.message('忘记密码请联系系统管理员');
}
</script>
<script>
scope.pagedata.wechat_login=function(){
	var url=scope.tool.custom_url('core/member.login/sq_login/session_id='+scope.pagedata.session_id,true);
	scope.tool.qr(url,'login_ewm');
	$('#modal_login_ewm').modal();
	scope.tool.wechat_login(function(res){
		if(res.to_uid==scope.pagedata.session_id && res.message && res.message.openid){
			scope.pagedata.info.openid=res.message.openid;
			$('#modal_login_ewm').modal('hide');
			scope.post(scope.pagedata.info,'core/member.login/wechat_login/');
		}
	});
}
</script>
